package com.xk.cart.config;

import com.xk.auth.utils.RsaUtils;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;

import javax.annotation.PostConstruct;
import java.security.PublicKey;

//添加配置文件中属性的前缀xk.sms
@ConfigurationProperties(prefix = "xk.jwt")
@Data
@Slf4j
//读配置文件中的属性
public class JwtProperties {

    private String pubKeyPath;// 公钥
    private PublicKey publicKey; // 公钥
    private String cookieName;
    // 对象一旦实例化后 读取公钥
    @PostConstruct
    public void init() throws Exception {
            // 获取公钥
            this.publicKey = RsaUtils.getPublicKey(pubKeyPath);

        }
    }




